<template>
  <dt-modal-edit ref='modal' title='新建奖金单' :label-width='110' :width='500' @ok='onOk' :loading='loading'>
  </dt-modal-edit>
</template>

<script>
  import Opt from '../opt/NewOpt.js'
  import yearMgr from '@/biz/bonus/yearend'
  
  export default {
    data() {
      return {
        info: {
          orgId: null,
          bonusName: null,
          bonusYear: null,
          bonusStartMonth: null,
          bonusEndMonth: null,
        },
        loading: false
      }
    },
    mounted() {
    },
    methods: {
      show() {
        this.$refs.modal.show(new Opt(this.info))
      },
      hide() {
        this.$refs.modal.hide()
      },
      onOk() {
        this.loading = true
        yearMgr.create(this.info).then((res) => {
          this.$router.push({
            path: `yearend/edit`,
            query: {
              id: res
            }
          })
          this.loading = false
        }).catch(err => {
          this.loading = false
        })
      }
    }
  }
</script>

<style lang="scss" scoped>
  ::v-deep .ivu-date-picker-header {
    display: none;
  }
</style>
